#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	int a = 2022;
	int ans = 0;
	int k = 0;
	while (a) {
		ans += (a % 10) * pow(9, k);
		a /= 10;
		k++;
	}
	cout << ans << endl;
	return 0;
}